﻿<!DOCTYPE html>

<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>SAEA.MVCTest</title>
</head>
<body>

    <div>
        <img src="6139455.png" />
    </div>

    <p>
        form get
    </p>
    <form action="/home/update" method="get">
        <p>id: <input type="text" name="id" /></p>
        <input type="submit" value="Submit" />
    </form>
    <p>
        form post
    </p>
    <form action="/home/update" method="post">
        <p>ID: <input type="text" name="ID" /></p>
        <p>UserName: <input type="text" name="UserName" /></p>
        <input type="submit" value="Submit" />
    </form>

    <p>
        form file
    </p>
    <form action="/File/upload" method="post" enctype="multipart/form-data">
        <p>name: <input type="text" name="name" /></p>
        <p>name: <textarea name="name2"></textarea></p>
        <p>File1: <input type="file" name="File1" /></p>
        <input type="submit" value="Submit" />
    </form>
    <p>
        form plain
    </p>
    <form action="/test/other" method="post" enctype="text/plain">
        <p>ID: <input type="text" name="ID" /></p>
        <p>UserName: <input type="text" name="UserName" /></p>
        <input type="submit" value="Submit" />
    </form>
    <p>
        form json
    </p>

    <form action="/test/other" method="post" enctype="application/json">
        <p>ID: <input type="text" name="ID" /></p>
        <p>UserName: <input type="text" name="UserName" value='{"asdfe":"bafeaf","#@!$%^%$%^&**&()(__":"!@#$#%#%$^* *(*(*)0_+_+_==857","ccc":"1111"}'/></p>
        <input type="submit" value="Submit" />
    </form>

    <div>
        <p>
            <button id="ajax_btn">ajaxTest--url get</button>

            <button id="ajax_btn1">ajaxTest--form get</button>

            <button id="ajax_btn2">ajaxTest2--form post</button>

            <button id="ajax_btn3">ajaxTest3--json</button>

            <button id="noAjax_btn" onclick="location.href = '/ajax/test?str=hello';">noajaxTest</button>
        </p>
    </div>

    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#ajax_btn").click(function () {
                $.get("/ajax/test?str=hello", null, function (data) {
                    alert(data);
                });
            });

            $("#ajax_btn1").click(function () {
                $.get("/ajax/test", "str=hello", function (data) {
                    alert(data);
                });
            });

            $("#ajax_btn2").click(function () {
                $.post("/ajax/test2", "str=hello", function (data) {
                    alert(data);
                });
            });

            var json = { "id": 1, "userName": "yswenli", "nickName": "WaLLE&@#$ %$=-090-=+)_(89~!@@!`123" };

            $("#ajax_btn3").click(function () {
                $.ajax({
                    url: "/ajax/test3",
                    type: "POST",
                    datType: "JSON",
                    contentType: "application/json",
                    data: JSON.stringify(json),
                    async: false,
                    success: function (result) {
                        alert(`id:${result.ID},username:${result.UserName},nickname:${result.NickName}`);
                    }
                });
            });

        });
    </script>

</body>
</html>